package com.boge.study.design_pattern.proxy.jdk_proxy;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class LogHandler implements InvocationHandler {
	
	private Object target;
	
	public LogHandler(Object target) {
		super();
		this.target = target;
	}

	/**
	 *
	 * @param proxy 代理类
	 * @param method 被代理对象的方法
	 * @param args 该方法的参数数组
	 * @return
	 * @throws Throwable
	 */
	@Override
	public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
		System.out.println("日志开始...");
		method.invoke(target);
		System.out.println("日志结束...");
		return null;
	}

}
